package utils;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

@SuppressWarnings("deprecation")
public class HibernateUtil {

    private static SessionFactory sessionFactory = null;

	public static SessionFactory getSessionFactory() {
    	if (sessionFactory == null){
	        try {
	            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
	      
	
	        } catch (Throwable ex) {
	            // Log exception!
	        	System.out.println("Y-ERROR");
	        	System.out.println(ex.toString());
	            throw new ExceptionInInitializerError(ex);
	        }
    	}
    	return sessionFactory;

    }

}

